pd <- position_dodge(0.3) # move them .05 to the left and right

# Multiple plot function
#
# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
# - cols:   Number of columns in layout
# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
#
# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
# then plot 1 will go in the upper left, 2 will go in the upper right, and
# 3 will go all the way across the bottom.
#
multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) {
  library(grid)

  # Make a list from the ... arguments and plotlist
  plots <- c(list(...), plotlist)

  numPlots = length(plots)

  # If layout is NULL, then use 'cols' to determine layout
  if (is.null(layout)) {
    # Make the panel
    # ncol: Number of columns of plots
    # nrow: Number of rows needed, calculated from # of cols
    layout <- matrix(seq(1, cols * ceiling(numPlots/cols)),
                    ncol = cols, nrow = ceiling(numPlots/cols))
  }

 if (numPlots==1) {
    print(plots[[1]])

  } else {
    # Set up the page
    grid.newpage()
    pushViewport(viewport(layout = grid.layout(nrow(layout), ncol(layout))))

    # Make each plot, in the correct location
    for (i in 1:numPlots) {
      # Get the i,j matrix positions of the regions that contain this subplot
      matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE))

      print(plots[[i]], vp = viewport(layout.pos.row = matchidx$row,
                                      layout.pos.col = matchidx$col))
    }
  }
}
numericcharacters <- function(x) {
  !any(is.na(suppressWarnings(as.numeric(x)))) & is.character(x)
}

scale1 <- function(x) scale(x)[,1]

construct_coef_df = function(dvs,df){
  fhab_mds = lapply(dvs, function(x) {
    lm(substitute(i ~ fhab + study_t + scanner_t, list(i = as.name(x))), data = df)
})
  fhab_sums = lapply(fhab_mds, summary)

  femo_mds = lapply(dvs, function(x) {
      lm(substitute(i ~ femo + study_t + scanner_t, list(i = as.name(x))), data = df)
  })
  femo_sums = lapply(femo_mds, summary)
  
  fhab_betas = c()
  femo_betas = c()
  fhab_se = c()
  femo_se = c()
  for (i in c(1:length(dvs))){
    fhab_betas = c(fhab_betas,fhab_sums[[i]]$coefficients[2,1])
    femo_betas = c(femo_betas,femo_sums[[i]]$coefficients[2,1] )
    fhab_se = c(fhab_se, fhab_sums[[i]]$coefficients[2,2])
    femo_se = c(femo_se, femo_sums[[i]]$coefficients[2,2])
  }
  
  coef_df = data.frame("IV" = c(rep("Habitual FB use", length(dvs)), rep("Emotional FB use", length(dvs))),
                       "DV" = c(dvs,dvs),
                       "beta" = c(fhab_betas, femo_betas),
                       "se" = c(fhab_se, femo_se))
  coef_df = coef_df %>%
  mutate(IV = factor(coef_df$IV, levels=c("Habitual FB use", "Emotional FB use")))
  return(coef_df)
}

plot_coef_df = function(coef_dv){
  g1 = ggplot(coef_df, aes(x=DV, y=beta, colour=IV)) + 
    geom_errorbar(aes(ymin= beta-1.96*se, ymax= beta+1.96*se), width=.1, position=pd) +
    geom_point(position=pd) + theme_pubr() + 
  scale_color_manual(values = c("Habitual FB use" = "dodgerblue", "Emotional FB use" = "forestgreen")) +
   geom_hline(yintercept=0, linetype="dashed", 
                color = "grey", size=1) + 
  rotate_x_text(45)
  return(g1)
}

construct_coef_df_iri = function(dvs,df){
  mds1 = lapply(dvs, function(x) {
    lm(substitute(i ~ IRI_Perspective_Taking + study_t + scanner_t, list(i = as.name(x))), data = df)
})
  sums1 = lapply(mds1, summary)
  
  mds2 = lapply(dvs, function(x) {
    lm(substitute(i ~ IRI_Fantasy + study_t + scanner_t, list(i = as.name(x))), data = df)
})
  sums2 = lapply(mds2, summary)
  
  mds3 = lapply(dvs, function(x) {
    lm(substitute(i ~ IRI_Empathic_Concern + study_t + scanner_t, list(i = as.name(x))), data = df)
})
  sums3 = lapply(mds3, summary)
  
  mds4 = lapply(dvs, function(x) {
    lm(substitute(i ~ IRI_Personal_Distress + study_t + scanner_t, list(i = as.name(x))), data = df)
})
  sums4 = lapply(mds4, summary)

  betas1 = c()
  betas2 = c()
  betas3 = c()
  betas4 = c()
  se1 = c()
  se2 = c()
  se3 = c()
  se4 = c()
  for (i in c(1:length(dvs))){
    betas1 = c(betas1,sums1[[i]]$coefficients[2,1])
    betas2 = c(betas2,sums2[[i]]$coefficients[2,1])
    betas3 = c(betas3,sums3[[i]]$coefficients[2,1])
    betas4 = c(betas4,sums4[[i]]$coefficients[2,1])
    se1 = c(se1, sums1[[i]]$coefficients[2,2])
    se2 = c(se2, sums2[[i]]$coefficients[2,2])
    se3 = c(se3, sums3[[i]]$coefficients[2,2])
    se4 = c(se4, sums4[[i]]$coefficients[2,2])
  }
  
  coef_df = data.frame("IV" = c(rep("Perspective taking", length(dvs)),
                                rep("Fantasy", length(dvs)),
                                rep("Empathic concern", length(dvs)),
                                rep("Personal distress", length(dvs))),
                       "DV" = c(dvs,dvs,dvs,dvs),
                       "beta" = c(betas1, betas2,betas3,betas4),
                       "se" = c(se1, se2,se3,se4))
  coef_df = coef_df
  return(coef_df)
}

plot_coef_iri = function(coef_dv){
  g1 = ggplot(coef_df, aes(x=DV, y=beta, colour=IV)) + 
    geom_errorbar(aes(ymin= beta-1.96*se, ymax= beta+1.96*se), width=.1, position=pd) +
    geom_point(position=pd) + theme_pubr()  +
   geom_hline(yintercept=0, linetype="dashed", 
                color = "grey", size=1) + 
  rotate_x_text(45)
  return(g1)
}

1. Participants

We include 59 participants in this report.

2. Data description

Habitual FB use.

1 - Strongly disagree 7 - Strongly agree

  1. Using Facebook is something I do automatically.
  2. Using Facebook is something I do without meaning to do it.
  3. Using Facebook is something I do without thinking.
  4. Using Facebook is something I start doing before I realize I’m doing it.
  5. Using Facebook is something that would require effort not to do it.
  6. Using Facebook is something I do without having to consciously remember.
  7. Using Facebook is something that belongs to my daily routine.
  8. Using Facebook is something I would find hard not to do.
  9. Using Facebook is something I have no need to think about doing.
  10. Using Facebook is something that’s typically “me”.

Emotional FB use.

  1. I feel connected to my friends when I use Facebook.
  2. I feel connected to my family members when I use Facebook.

I get an urge to post on Facebook from my computer or phone the moment when … 3. something makes me feel amused
4. something makes me feel surprised 5. something makes me feel awed 6. something makes me feel loved 7. something makes me feel proud
8. something makes me feel excited
9. something makes me feel grateful 10. something makes me feel happy
11. something makes me feel inspired
12. something makes me feel confident
13. something makes me feel angry
14. something makes me feel nervous 15. something makes me feel awkward 16. something makes me feel stressed
17. something makes me feel jealous 18. something makes me feel lonely
19. something makes me feel scared
20. something makes me feel upset
21. something makes me feel ashamed 22. something makes me feel guilty

ROIS

Scrit to obtain the ROI values at jupyter hub.

Table continues below
name source
subacc_roi_mask functional ROI
rInsula_roi_mask functional ROI
lInsula_roi_mask functional ROI
functional_combined_roi_mask functional ROI
dmpfc_roi_mask Dufour et al., 2013
mmpfc_roi_mask Dufour et al., 2013
vmpfc_roi_mask Dufour et al., 2013
mpfc_roi_mask Dufour et al., 2013
precuneus_roi_mask Dufour et al., 2013
lTpj_roi_mask Dufour et al., 2013
rTpj_roi_mask Dufour et al., 2013
rSts_roi_mask Vijayakumar et al., 2017
saxe_combined_mask Vijayakumar et al., 2017
ns_ment_mask Vijayakumar et al., 2017
ns_ment_clust1_mask Vijayakumar et al., 2017
ns_ment_clust2_mask Vijayakumar et al., 2017
ns_ment_clust3_mask Vijayakumar et al., 2017
ns_ment_clust4_mask Vijayakumar et al., 2017
ns_ment_clust7_mask Vijayakumar et al., 2017
image %>% pander::pandoc.image.return()

4. Linking FB use with neural data

Dufour mentalzing meta-analytic ROIS

Observations 59
Dependent variable saxe_combined_mask
Type OLS linear regression
F(4,54) 2.216
0.141
Adj. R² 0.077
Est. S.E. t val. p
(Intercept) 0.175 3.271 0.054 0.957
fhab 0.101 0.057 1.778 0.081
age -0.035 0.190 -0.184 0.854
study_ttps2 0.528 0.204 2.593 0.012
scanner_tscanner2 -0.323 0.200 -1.615 0.112
Standard errors: OLS